package com.gui.collection.map;

import cn.hutool.core.util.RandomUtil;
import lombok.extern.slf4j.Slf4j;

import java.util.*;
import java.util.stream.Collectors;

@Slf4j
public class HashMapDemo {

    public static void main(String[] args) {
        Map<Integer, HashSet<String>> map = new HashMap<>();
        String[] uuidArray = {"160f1f49-971f-4855-9c7c-ee74350e8096", "2da6e1c8-c0a6-41c0-8de1-619c5bd5ed32", "2fbea18b-e123-4588-903a-8268fe67baca"};
        for (int i = 0; i < 10; i++) {
            findHash(i + 1);
        }
        // dwb7uk   f9b7uk

    }


    static final int hash(Object key) {
        int h;
        return (key == null) ? 0 : (h = key.hashCode()) ^ (h >>> 16);
    }

    static final void findHash(int count) {
        List<String> list = new ArrayList<>();
        for (int i = 0; i < 100000000; i++) {
            String uuid = RandomUtil.randomString(5);
            int hash = hash(uuid);
            if (hash == -1319221984) {
                log.info("发现一条满足条件的数据：{}", uuid);
                list.add(uuid);
            }
        }
        log.debug("第{}轮查询结果：{}", count, list);
    }
}
